package com.cgg.order.controller;

import com.cgg.order.service.OrderService;
import com.cgg.order.vo.ExchangeOrder;
import com.cgg.stock.common.util.ResponseData;
import com.cgg.stock.common.util.ResponseDataUtil;
import com.cgg.stock.common.util.ResultEnums;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 添加委托订单
     *
     * @param order
     * @return
     */
    @PostMapping("addOrder")
    @Transactional
    public ResponseData addOrder(@RequestBody ExchangeOrder order) throws Exception {

        orderService.addOrder(order);

        return ResponseDataUtil.buildOk(ResultEnums.OK);
    }

}
